package com.loy;

import com.loy.service.HelloServiceImpl;
import com.loy.service.TestServiceImpl;
import io.grpc.Server;
import io.grpc.ServerBuilder;

import java.io.IOException;

public class GrpcServer1 {

    public static void main(String[] args) throws InterruptedException, IOException {
        // 绑定端口
        ServerBuilder<?> serverBuilder = ServerBuilder.forPort(9000);

        // 将我们自定义的服务，发布出去
        serverBuilder.addService(new HelloServiceImpl());
        serverBuilder.addService(new TestServiceImpl());

        // 创建服务对象
        Server server = serverBuilder.build();
        server.start(); // 开启服务
        server.awaitTermination();// 等待
    }
}
